﻿using System;
using UnityEngine;

// Token: 0x02000029 RID: 41
public class VoiceScript : MonoBehaviour
{
	// Token: 0x060000B4 RID: 180 RVA: 0x0000FD56 File Offset: 0x0000DF56
	private void Start()
	{
		this.body = base.GetComponent<BodyScript>();
	}

	// Token: 0x060000B5 RID: 181 RVA: 0x0000FD64 File Offset: 0x0000DF64
	public void Hit()
	{
		if (this.body)
		{
			if (this.body.health > 0f && Random.Range(0f, 1f) < this.painSoundChance)
			{
				Sound.Play(this.painSounds[Random.Range(0, this.painSounds.Length)], this.body.head.transform.position, false, true, 1f);
				return;
			}
			if (this.body.health < 0f && this.body.alive && Random.Range(0f, 1f) < this.deathSoundChance)
			{
				Sound.Play(this.deathSounds[Random.Range(0, this.deathSounds.Length)], this.body.head.transform.position, false, true, 1f);
				Object.Destroy(this);
			}
		}
	}

	// Token: 0x060000B6 RID: 182 RVA: 0x0000FE60 File Offset: 0x0000E060
	public void Cheer()
	{
		if (this.body && this.body.health > 0f && this.cheerSounds.Length != 0 && Random.Range(0f, 1f) < this.cheerSoundChance)
		{
			Sound.Play(this.cheerSounds[Random.Range(0, this.cheerSounds.Length)], this.body.head.transform.position, false, true, 1f);
		}
	}

	// Token: 0x060000B7 RID: 183 RVA: 0x0000FEE8 File Offset: 0x0000E0E8
	public void Alert()
	{
		if (this.body && this.body.health > 0f && this.alertSounds.Length != 0 && Random.Range(0f, 1f) < this.alertSoundChance)
		{
			Sound.Play(this.alertSounds[Random.Range(0, this.alertSounds.Length)], this.body.head.transform.position, false, true, 1f);
		}
	}

	// Token: 0x060000B8 RID: 184 RVA: 0x0000FF70 File Offset: 0x0000E170
	public void Attack()
	{
		if (this.body && this.body.health > 0f && Random.Range(0f, 1f) < this.attackSoundChance)
		{
			Sound.Play(this.attackSounds[Random.Range(0, this.attackSounds.Length)], this.body.head.transform.position, false, true, 1f);
		}
	}

	// Token: 0x04000193 RID: 403
	public AudioClip[] alertSounds;

	// Token: 0x04000194 RID: 404
	public AudioClip[] attackSounds;

	// Token: 0x04000195 RID: 405
	public AudioClip[] painSounds;

	// Token: 0x04000196 RID: 406
	public AudioClip[] cheerSounds;

	// Token: 0x04000197 RID: 407
	public AudioClip[] deathSounds;

	// Token: 0x04000198 RID: 408
	[Range(0f, 1f)]
	public float alertSoundChance;

	// Token: 0x04000199 RID: 409
	[Range(0f, 1f)]
	public float attackSoundChance;

	// Token: 0x0400019A RID: 410
	[Range(0f, 1f)]
	public float painSoundChance;

	// Token: 0x0400019B RID: 411
	[Range(0f, 1f)]
	public float cheerSoundChance;

	// Token: 0x0400019C RID: 412
	[Range(0f, 1f)]
	public float deathSoundChance;

	// Token: 0x0400019D RID: 413
	private BodyScript body;
}
